Repository navigation
docs(guardrails): say how PII redaction works on streaming requests - #1168
Open
ninadphalak wants to merge 2 commits into
Open
ninadphalak wants to merge 2 commits into
ninadphalak wants to merge 2 commits into
Conversation
Contributor
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PII redaction page says the same guardrail can go in
after_request_hooksto redact PII in LLM responses. It doesn't say what happens when the request streams, and that page is where I'd look first.The guardrails page already answers it under Streaming Responses. Output guardrails run on the full response after the stream ends, and on streaming no action is taken. So a streamed response reaches the client unredacted, and the verdict only shows up in
hook_results.I added a short note under the existing one on the PII redaction page, and the same note on the copy under
aigw/. It links to that section and says to usestream: falsewhen the response has to be redacted. In the open-source gateway,responseHandlers.tsreturns the stream on a streaming request before the after-request hooks run.The second paragraph of the note links the OWASP AI Exchange section on streamed output and a report I wrote on the same problem. If you'd rather keep the note to Portkey's own behaviour, I'll drop that paragraph.